package projectmanagement.models;
/**
 * @author Zhimolokhov Oleg
 *
 *This class is used for creating the instance of Task.
 *
 */
public class Task {

    private int taskId;
    private int estimation;

	private User currentUser;
	private Iteration currentIteration;
	private String description;
	private boolean taskStatus;

	
		
	public Task(User currentUser, Iteration currentIteration,int estimation) {
		this.currentUser = currentUser;
		this.currentIteration=currentIteration;
		this.estimation = estimation;
	}

    public Task(int estimation, String description){
        this.estimation = estimation;
        this.description = description;
        taskStatus = false;
    }

	public void setUser(User currentUser) {
		this.currentUser = currentUser;
	}

    public void setId(int id) {
        this.taskId = id;
    }

	public Integer getId() {
		return taskId;
	}
    
    public User getUser() {
        return currentUser;
    }

    @Override
    public String toString() {
        StringBuilder out = new StringBuilder();
        out.append("Current user: " + ((currentUser!=null) ? currentUser.getName() : "[NO USER ASSIGNED]"))
                .append("\n")
                .append("Status of the task is: "+ (taskStatus ? "Done" : "Development stage"))
                .append("\n")
                .append("Estimation of the task is: "+estimation)
                .append("\n")
                .append("Detailed description: "+description)
                .append("\n");

        return out.toString();
    }
}
